<?php
$loader->requireOnce('includes/LabAssignment/LabServiceModel.class.php');
 /* model for lab assignment 
 * @package modules.dept_laboratory.includes
 * @author viethd
 * @version $Id$
 * @copyright 2009 LHV Company
 */
class LabGroupModel {    
	private $_name;
	private $_id;
	private $_listOfLabService = array();
    function __construct() {
    	            
    }    
    public function setData($groups) {
    	$this->_id = $groups['lab_group_id'];
    	$this->_name = $groups['name'];
    	$servicesObj = Celini::newOrdo("LabService");
    	$services = $servicesObj->loadLabServices($groups['lab_group_id']);
    	foreach ($services as $labService) {
    		$labServiceModel = new LabServiceModel();
    		$labServiceModel->setData($labService);
    		$this->_listOfLabService[$labService['service_id']] = $labServiceModel;    		
    	}    	
    }
    /**
     * 
     * @return list of lab services.
     */
    public function listLabServices() {
    	return $this->_listOfLabService;
    }
    /**
     * 
     * @param $labGroupId
     * @return
     * <br> 
     * a group service obj if found
     * <br>
     * null if not found.
     */
    public function getLabService($labGroupId) {
    	if (isset($this->_listOfLabService[$labGroupId]))  {
    		return $this->_listOfLabService[$labGroupId];
    	}
        return null;
    }
}
?>